//
//  ServiceController.m
//  ServiceDebianManager
//
//  Created by Léo Lego on 13/05/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "ServiceController.h"
#import "ServicesManager.h"
@interface ServiceController ()

@end

@implementation ServiceController
@synthesize panel;
@synthesize serviceField;


-(id) initWithWindowNibName:(NSString *)windowNibName AndMother:(id)Mother{
	if(self = [super initWithWindowNibName:windowNibName]){
		NSLog(@"INIT Controller server");
		mother = Mother;
	}
	return  self;
}

- (IBAction)addButton:(id)sender {
	if(serviceField.stringValue.length !=0){
		[mother addServiceWithService:serviceField.stringValue];
		[panel setIsVisible:NO];
		
	} else {
		NSAlert * alert = [[NSAlert alloc] init];
		[alert setMessageText:@"A zone is empty !"];
		[alert runModal];
	}
}

- (void)keyDown:(NSEvent *)theEvent {
    //[self interpretKeyEvents:[NSArray arrayWithObject:theEvent]];
	NSLog(@"touche pressed");
}

@end
